#include <xc.h>

void delay(void); // We have a delay function later on.

unsigned int delayVal = 4096; // Change this to change how fast the led blinks.

int main(void) {

  LATA = 0; // Sets all the values in this register to 0.
  TRISA = 0; // All pins in this register are outputs.

  // Blink an led.
  while(1) {

    LATAbits.LATA0 = 1; // Pin RA0 = high.
    delay();
    LATAbits.LATA0 = 0; // Pin RA0 = low.
    delay();

  }

}

// Do nothing, in an incredibly ugly way. But it works!
void delay(void) {
  unsigned int i,k;

  for (i = 0; i < delayVal; i++) {

    for (j = 0; j < 20; j++);
  
  }
}
